import Opt from '@/components/dt/info/Opt.js'

let _this = null
let unitObj = {
  NUMBER: '套',
  AMOUNT: '万',
  AREA: '㎡'
}
let labelObj = {
  NUMBER: '套数',
  AMOUNT: '金额',
  AREA: '面积'
}
let labelObj1 = {
  CLUETARGET: '线索',
  VISITOR: '来人',
  SUBSCRIPTION: '认购',
  CONTRACT: '签约',
  PAYMENT: '回款'
}
class Column extends Opt {
  constructor(vm) {
    super()
    _this = vm
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    let clueOrVisitorList = [
      {
        field: 'beforeValue',
        title: `原${labelObj1[_this.curState]}目标(${_this.curState != 'PAYMENT' ? '组' : '万'})`,
        minWidth: 180
      },
      {
        field: 'afterValue',
        title: `调整后${labelObj1[_this.curState]}目标(${_this.curState != 'PAYMENT' ? '组' : '万'})`,
        minWidth: 180
      }
    ]
    let subOrContractList = [
      {
        field: 'beforeValue',
        title: `原${labelObj1[_this.curState]}${labelObj[_this.otherState]}(${unitObj[_this.otherState]})`,
        minWidth: 180
      },
      {
        field: 'afterValue',
        title: `调整后${labelObj1[_this.curState]}${labelObj[_this.otherState]}(${
          unitObj[_this.otherState]
        })`,
        minWidth: 180
      }
    ]
    let part1 = [
      {
        field: 'userName',
        title: '操作人',
        minWidth: 150
      },
      {
        field: 'createTime',
        title: '操作时间',
        minWidth: 180
      }
    ]
    if (_this.curState == 'SUBSCRIPTION' || _this.curState == 'CONTRACT') {
      this.all = [...subOrContractList, ...part1]
    } else {
      this.all = [...clueOrVisitorList, ...part1]
    }
  }
}

export default Column
